//
//  HJBaseController.m
//  newOcWeibo
//
//  Created by heJing on 15/7/27.
//  Copyright © 2015年 heima. All rights reserved.
//

#import "HJBaseController.h"
#import "HJOAuthController.h"
#import "HJAccount.h"
@interface HJBaseController ()<HJDefaultCenterViewDelegate>

@end

@implementation HJBaseController

-(void)loadView
{
    // 1.获取授权信息
    HJAccount *account = [HJAccount accountFromSandbox];

    // 2. 判断是否授权
    if (account != nil) {
        
        [super loadView];
    }else{
        
        // 2.2显示默认界面
        HJDefaultCenterView *centerView = [HJDefaultCenterView defaultCenterView];
        self.view = centerView;
        centerView.delegate = self;
        self.defaultCenterView = centerView;
    }
    
    
}

-(void)defaultCenterView:(HJDefaultCenterView *)defaultCenterView registerButton:(UIButton *)button
{
}

-(void)defaultCenterView:(HJDefaultCenterView *)defaultCenterView loginButton:(UIButton *)button
{
    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"HJOAuthController" bundle:nil];
    UIViewController *oauthVc = sb.instantiateInitialViewController;
    [self presentViewController:oauthVc animated:YES completion:nil];
}

@end
